package com.gy.bearhelps.setting.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gy.bearhelps.R;
import com.gy.bearhelps.setting.bean.MessageBean;

import java.util.List;

/**
 * 作者：gy on 16/11/5
 * 说明：
 */
public class MessageAdapter extends BaseAdapter {

    private Context context;
    private List<MessageBean> lists;

    public MessageAdapter(Context context,List<MessageBean> lists){
        this.context = context;
        this.lists = lists;
    }

    @Override
    public int getCount() {
        return lists.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if(view == null){
            view = View.inflate(context, R.layout.adapter_handle_home,null);
            holder = new ViewHolder();
            holder.tvTitle = (TextView) view.findViewById(R.id.adapter_handle_tv_title);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tvTitle.setText(lists.get(i).title+"");

        return view;
    }

    class ViewHolder{
        TextView tvTitle;
    }
}
